package com.nisco.nio.socket.sendstring;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args)
        throws IOException, InterruptedException {
        System.out.println("client begin " + System.currentTimeMillis());
        Socket socket = new Socket("127.0.0.1", 8088);
        System.out.println("client end " + System.currentTimeMillis());
        Thread.sleep(5000);

        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("我是中国人".getBytes());
        Thread.sleep(3000);
        outputStream.write("我是中国人2".getBytes());
        outputStream.flush();
        Thread.sleep(3000);
        outputStream.write("我是中国人3".getBytes());

        outputStream.flush();
        outputStream.close();
        socket.close();
    }
}
